@extends('layouts.app')

@section('content')
    <div class="row justify-content-center mt-5">
        <div class="col-10">
            <nav aria-label="breadcrumb mb-3">
                <ol class="breadcrumb">
                    @foreach($routers as $router)
                        <li class="breadcrumb-item">
                            @if($loop->last)
                                {{ $router->name }}
                            @else
                                <a href="{{ $router->path }}">{{ $router->name }}</a>
                            @endif
                        </li>
                    @endforeach
                </ol>
            </nav>

            <ul class="list-group">
                @foreach($files as $item)
                <li class="list-group-item">
                    @if($item['isdir'] == 1)
                    <a class="d-flex align-items-center justify-content-between"
                       href="{{ route('root', ['path' => $item['path']]) }}">
                    @else
                    <a class="d-flex align-items-center justify-content-between"
                       href="{{ route('down', [
                           'fsId' => $item['fs_id'],
                       ]) }}"
                       target="_blank">
                    @endif
                        <div class="d-flex align-items-center">
                            <div class="mr-2">
                                @if($item['isdir'] == 1)
                                    <i class="bi bi-folder"></i>
                                @elseif(in_array($item['suffix'], config('pan.zipSuffix')))
                                    <i class="bi bi-file-zip"></i>
                                @else
                                    <i class="bi bi-file"></i>
                                @endif
                            </div>
                            <div class="title">{{ $item['server_filename'] }}</div>
                        </div>
                        @if($item['isdir'] == 0)
                            <div class="right">
                                <div class="size">{{ formatSize($item['size']) }}</div>
                            </div>
                        @endif
                    </a>
                </li>
                @endforeach
            </ul>
        </div>
    </div>
@endsection
